import request from '@/utils/request';
const basePath = '/appsys/passwordtemplet/AppPasswordTempletRest';
import type { BaseBeanModel, ResponsePageData, ResponseBaseData, QueryParamModel } from '@/api/model/baseModel';

export interface SysPasswordTemplateDto extends BaseBeanModel {
  /** 密码规则KEY */
  templetKey?: any;
  /** 密码规则描述 */
  configureName?: string;
  /** 密码规则值 */
  templetValue?: string;
  /** 是否有效1有效，0无效， 默认1 */
  templetState?: any;
}

/**
 * 获取分页数据
 * @param param QueryParamModel
 * @returns 列表数据
 */
export function listSysPasswordTemplateByPage(
  param: QueryParamModel
): Promise<ResponsePageData<SysPasswordTemplateDto>> {
  return request.post(`${basePath}/search-sub-by-page/v1`, param);
}

/**
 * 根据id加载主表数据
 * @param id 该行数据id
 * @returns 表单数据
 */
export function getSysPasswordTemplate(id: string): Promise<ResponseBaseData<SysPasswordTemplateDto>> {
  return request.get(`${basePath}/get-sub/${id}/v1`);
}

/**
 * 保存表单数据
 * @param data 该行表单数据
 * @returns 编辑后的表单数据
 */
export function saveSysPasswordTemplate(data: any): Promise<ResponseBaseData<any>> {
  return request.put(`${basePath}/save-sub/v1`, data);
}

/**
 * 批量保存数据
 * @param params 修改的数据
 * @returns 集中编辑后的新数据
 */
export function saveAllSysPasswordTemplate(params: any): Promise<ResponseBaseData<any>> {
  return request.post(`${basePath}/batchUpdateSub/v1`, params);
}
